Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the call to isAlive() which is broken #1

Merged
merged 2 commits into from
Dec 14, 2022

Conversation

gmsanchez
Copy link
Owner

The update of glibc from 2.31 to 2.35 in Ubuntu changed the semantics of pthread_kill. It used to return an error when a dead thread exited, and now it returns 0.

This new behavior is POSIX-compatible as the result of pthread_kill on a thread that died produces undefined behavior, so techincally 0 is valid result.

This isAlive() will return that a dead thread is alive in the newer glibc versions.

This patch removes the use of isAlive and instead uses tryjoin, which should behave correctly for dead threads.

bluespace-ai#17

The update of glibc from 2.31 to 2.35 in Ubuntu changed the semantics of
pthread_kill.  It used to return an error when a dead thread exited, and
now it returns 0.

This new behavior is POSIX-compatible as the result of pthread_kill on a
thread that died produces undefined behavior, so techincally 0 is valid
result.

This isAlive() will return that a dead thread is alive in the newer
glibc versions.

This patch removes the use of isAlive and instead uses tryjoin, which
should behave correctly for dead threads.
do not spin forever if some thread is invalid or it's a EDEADLK
@gmsanchez gmsanchez merged commit 19acc4e into gmsanchez:ros2_0_humble Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants